import React from 'react'
import { withRouter } from 'react-router-dom'
import { connect } from 'react-redux'
import { denglu, getMsg } from '../../redux/actionCreator'
import pxPage from '../../root/pxPage'
import { ceshi } from '../../redux/actionCreator'
import { TabBar } from "antd-mobile"
const bushometitle = {
    widtd: pxPage(200),
    heigth: pxPage(33),
    position: 'absolute',
    top: pxPage(100),
    left: pxPage(44),
    fontSize: pxPage(28),
    paddingBottom: pxPage(8),
}
const bushometitletwo = {
    widtd: pxPage(200),
    heigth: pxPage(33),
    position: 'absolute',
    top: pxPage(100),
    left: pxPage(174),
    fontSize: pxPage(28),
    paddingBottom: pxPage(8),
}
const bushometitlethree = {
    widtd: pxPage(200),
    heigth: pxPage(33),
    position: 'absolute',
    top: pxPage(100),
    right: pxPage(44),
    fontSize: pxPage(28),
    paddingBottom: pxPage(8),
}

const touxianggexing = {
    width: '100%',
    height: pxPage(140),
    borderBottom: '1.5px solid #fff'
}

const tuxianghello = {
    // width: pxPage(160),
    height: pxPage(20),
    position: 'absolute',
    top: pxPage(33),
    left: pxPage(86)
}

const touxiangimg = {
    width: pxPage(45),
    height: pxPage(45),
    position: 'absolute',
    top: pxPage(30),
    left: pxPage(0),
    borderRadius: '50%',
    border: '1px solid #fff',
    objectFit: 'cover'
}
class Touxiang extends React.Component {
    constructor(props) {
        super(props);
        this.state = {};
    }
    render() {
        const { pathname } = this.props.location;
        return (
            <div className='touxiang' style={touxianggexing}>

                <div
                    style={{ position: 'absolute', left: '5%' }}
                    onClick={() => {
                        this.props.history.push('/busme')
                    }}
                >
                    {/* 头像 */}
                    <img style={touxiangimg} src={`http://www.h5weixin.club:1025/api/image/${getMsg(this.props).business_pic}`}></img>
                </div>
                <span style={tuxianghello}>{getMsg(this.props).business_name}</span>
                <TabBar
                    unselectedTintColor="grey"
                    tintColor="white"
                    barTintColor="black"
                >
                    <TabBar.Item
                        title="我的发布"
                        key="myfabu"
                        icon={
                            <i className='iconfont icon-shouye1'></i>
                        }
                        selectedIcon={
                            <i className='iconfont icon-wodedangxuan'></i>
                        }
                        selected={pathname === '/bushome'}
                        onPress={() => {
                            this.props.history.push('/bushome')
                        }}
                        data-seed="logId"
                    ></TabBar.Item>
                    <TabBar.Item
                        icon={
                            <i className='iconfont icon-shouye1'></i>
                        }
                        selectedIcon={
                            <i className='iconfont icon-wodedangxuan'></i>
                        }
                        title="发布"
                        key="fabu"
                        selected={pathname === '/bushome/release'}
                        onPress={() => {
                            this.props.history.push('/bushome/release')
                        }}
                        data-seed="logId1"
                    ></TabBar.Item>
                    <TabBar.Item
                        icon={
                            <i className='iconfont icon-shouye1'></i>
                        }
                        selectedIcon={
                            <i className='iconfont icon-wodedangxuan'></i>
                        }
                        title="待审核"
                        key="daishenhe"
                        selected={pathname === '/bushome/examine'}
                        onPress={() => {
                            this.props.history.push('/bushome/examine')
                        }}
                    ></TabBar.Item>
                </TabBar>
            </div>
        )
    }
}

const mapStateToProps = (state) => ({
    login: state.login
})

export default withRouter(connect(mapStateToProps)(Touxiang))
